# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=sh00t
pkgver=214.8c7321f
pkgrel=4
pkgdesc='A Testing Environment for Manual Security Testers.'
groups=('blackarch' 'blackarch-misc')
arch=('any')
url='https://github.com/pavanw3b/sh00t'
license=('MIT')
depends=('python' 'python-django-rest-framework' 'python-pytz'
         'python-django-tables2')
makedepends=('git')
source=("git+https://github.com/pavanw3b/$pkgname.git")
sha512sums=('SKIP')
install="$pkgname.install"

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 README.md "$pkgdir/usr/share/doc/$pkgname/README"
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  cp -a --no-preserve=ownership * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python manage.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

